﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace StyleMVVM.Data.Transform
{
	public sealed class PrimitiveTransformStrategy : ITransformStrategy
	{
		private Type convertType;

		public bool IsLooseTranform
		{
			get { return true; }
		}

		public void Initalize()
		{
		}

		public object Transform(object valueIn, Type transformHint)
		{
			if (valueIn != null)
			{
				return Convert.ChangeType(valueIn, transformHint);
			}

			if (transformHint.GetTypeInfo().IsPrimitive)
			{
				return Activator.CreateInstance(transformHint);
			}

			return null;
		}
	}
}